<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>DN_KEY</title>
<meta http-equiv="Content-Type" Content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="../../../styles/styles.css">
<script language="javascript" src='../../links.js' type="text/javascript"></script>
</head>
<body>

<h1>DN_KEY</h1>
<div class=navbar>
<a  href="index_dn.html">Events</a> |
<a href="../index.html">Dialog API</a><br>
</div>

<div class=shortdescr>
The <dfn>DN_KEY</dfn> event is sent to the dialog callback function after the user presses a key in the dialog.
</div>

<h3>Param1</h3>
<div class=descr>
The ID of the dialog item receiving the event (usually it is the item that has the keyboard focus).
</div>

<h3>Param2</h3>
<div class=descr>
<a href="../../defs/farkeycodes.html">Internal key code</a>.
</div>

<h3>Return</h3>
<div class=descr>
TRUE - the key was processed internally.<br>
FALSE - the key should be processed by the internal handler of the Dialog API kernel.
</div>

<h3>Remarks</h3>
<div class=descr>
By default the <dfn>DN_KEY</dfn> event is not sent for an open <a href="../controls/di_combobox.html">DI_COMBOBOX</a>.
Use the <a href="dm_setcomboboxevent.html">DM_SETCOMBOBOXEVENT</a> message to enable the sending of <dfn>DN_KEY</dfn> events.
</div>

<h3>Example</h3>
<div class=descr>
Example of processing the event:
<pre class=code>
// Center the dialog if the user has pressed Ctrl-Apps
case DN_KEY:
  if(Param2 == KEY_CTRLAPPS)
  {
    COORD c={-1,-1};
    Info.SendDlgMessage(hDlg,DM_MOVEDIALOG,TRUE,(LONG_PTR)&amp;c);
    return TRUE;
  }
</pre>
</div>


<div class=see>See also:</div><div class=seecont>
<a href="../dialogex.html">DialogEx</a>,
<a href="dm_key.html">DM_KEY</a>
</div>

</body>
</html>
